<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../static/vue/2.6.10/vue.js" type="text/javascript"></script>
    <title>Title</title>
</head>
<body>
    <div id="app">
        <button @click="greet">Greet</button>
        <button @click="say('hi')">Say hi</button>
        <button @click="say('what')">Say what</button>
    </div>

    <script type="text/javascript">
        let vm = new Vue({
            el: '#app',
            data: {
                name: 'Marlboro'
            },
            methods: {
                greet: function (event) {
                    // `this` 在方法里指向当前 Vue 实例
                    alert('Hello ' + this.name + '!');
                    // `event` 是原生 DOM 事件
                    if (event) {
                        alert(event.target.tagName);
                    }
                },
                say: function (message) {
                    alert(message);
                }
            }
        });
    </script>
</body>
</html>